export const columns = context => {
  return [
    {
      // prop: 'messageName',
      label: '名称',
      minWidth: 100,
      align: 'left',
      render: (h, row) => {
        const color = row.isLook === '1' ? 'fc-success' : 'fc-error'
        return (
          <span>
            <span class={color}>●</span>
            <span>
              【{row.messageTypeName}】{row.messageName}
            </span>
          </span>
        )
      }
    },
    {
      prop: 'createTime',
      label: '时间',
      width: 180
    }
  ]
}

export const saleLabelType = [
  {
    name: '销售总额',
    key: 'saleTotalPrice',
    value: '1'
  },
  {
    name: '销售单数量',
    key: 'orderCount',
    value: '2'
  },
  {
    name: '实际应收',
    key: 'actualSaleTotalPrice',
    value: '3'
  },
  {
    name: '退款金额',
    key: 'refundTotalPrice',
    value: '4'
  },
  {
    name: '已回款总额',
    key: 'payMoney',
    value: '5'
  },
  {
    name: '剩余应收',
    key: 'residuePrice',
    value: '6'
  },
  {
    name: '逾期金额',
    key: 'overduePrice',
    value: '7'
  }
]

export const rankingType = [
  {
    name: '个人排行',
    value: '1'
  },
  {
    name: '部门排行',
    value: '2'
  }
]

export const followType = [
  {
    name: '我提交的',
    value: '1'
  },
  {
    name: '待我查阅',
    value: '2'
  },
  {
    name: '部门客户记录',
    value: '3'
  }
]

export const cusomterFollowColumns = context => {
  return [
    {
      // prop: 'messageName',
      label: '名称',
      width: 100,
      align: 'left',
      render: (h, row) => {
        const color = row.isConsulted === '1' ? 'green' : 'fc-error'
        const sric = row.isConsulted === '1' ? '已查阅' : '未查阅'
        return (
          <span>
            <span class={color}>● {sric}</span>
          </span>
        )
      }
    },
    {
      prop: 'customerName',
      label: '',
      minWidth: 180
    },
    {
      prop: 'followAccountName',
      label: '',
      width: 180
    },
    {
      prop: 'followTime',
      label: '',
      width: 120
    },
    {
      prop: 'followType',
      label: '',
      width: 120
    }
  ]
}

export const dataColumns = ctx => {
  return [
    {
      prop: 'name',
      label: '销售人员'
    },
    {
      prop: 'orderCustomerCount',
      label: '订单客户数'
    },
    {
      // prop: "customerCount",
      label: '新增客户数',
      render: (h, row) => {
        return +row.customerCount > 0 ? (
          <a
            class="text-primary"
            href="javascript:void(0);"
            onClick={() => {
              ctx.ontoCustomerDetail(row)
            }}
          >
            {row.customerCount}
          </a>
        ) : (
          <span>{row.customerCount}</span>
        )
      }
    },
    {
      prop: 'orderCount',
      label: '订单数',
      render: (h, row) => {
        return +row.orderCount > 0 ? (
          <a
            class="text-primary"
            href="javascript:void(0);"
            onClick={() => {
              ctx.ontoSaleOrder(row)
            }}
          >
            {row.orderCount}
          </a>
        ) : (
          <span>{row.orderCount}</span>
        )
      }
    },
    {
      prop: 'saleTotalPrice',
      label: '销售单总额'
    },
    {
      prop: 'departmentName',
      label: '所属事业部'
    },
    {
      prop: 'actualSaleTotalPrice',
      label: '实际应收'
    },
    {
      prop: 'refundTotalPrice',
      label: '退款金额'
    },
    {
      prop: 'payMoney',
      label: '已回款金额'
    },
    {
      prop: 'residuePrice',
      label: '剩余应收'
    },
    {
      prop: 'overduePrice',
      label: '逾期金额'
    }
  ]
}
